#include "structure/Floor.h"
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtx/transform2.hpp>
#include <glm/gtx/projection.hpp>

Floor::Floor(GLuint programHandler, GLShaderConfig shaderConfig, float widthX, float widthY, float height) :
	GLStructure(programHandler, shaderConfig),
	widthX(widthX),
	widthY(widthY),
	height(height) {
	floor = new Cube(programHandler, shaderConfig);

	floor->setColor(0.3, 0.3, 0.3);
}

Floor::~Floor() {
	delete floor;
}

void Floor::updateComponents() {
	glm::mat4 transformation = glm::translate(transformationMatrix, glm::vec3(0, 0, -height / 2));
	transformation = glm::scale(transformation, glm::vec3(widthX, widthY, height));
	floor->transform(transformation);
}

void Floor::update (glm::mat4 viewMatrix, glm::mat4 modelMatrix) {
	updateComponents();
	floor->update(viewMatrix, modelMatrix);
}

